<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">
	<p:dialog header="Gestion Utilisateur" draggable="true" widgetVar="userGestion" resizable="false"
		showEffect="fade" hideEffect="fade">
		<h:form id="formUserGestion">
			<p:panel id="panelUserGestion" header="New User" style="margin-bottom:10px;">
				<h:panelGrid columns="3" cellspacing="5">
					<h:outputLabel value="Firstname" for="firtname" />
					<p:inputText id="firtname" value="#{userMBean.user.firtName}"
						label="firtname" required="true" />
					<p:message for="firtname" />
					<h:outputLabel value="lastname" for="lastname" />
					<p:inputText id="lastname" value="#{userMBean.user.lastName}"
						label="lastname" required="true" />
					<p:message for="lastname" />
					<h:outputLabel value="email" for="email" />
					<p:inputText id="email" value="#{userMBean.user.email}"
						label="email" required="true" />
					<p:message for="email" />
					<h:outputLabel value="password" for="password" />
					<p:password id="password" value="#{userMBean.user.password}"
						feedback="true" label="password" required="true"
						promptLabel="Saisir le mot de passe" weakLabel="leger"
						goodLabel="moyen" strongLabel="bon" />
					<p:message for="password" />
				</h:panelGrid>
				<p:commandButton id="submit" value="OK"
					actionListener="#{userMBean.createUser}" update="display,panelUserGestion" process=":dialog1:formUserGestion"/>
			</p:panel>
			<p:panel id="display" header="Information" style="margin-top:10px;">
				<p:dataTable id="dataTable" var="user" value="#{userMBean.users}"
					paginator="true" rows="10"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="5,10,15,50">
					<f:facet name="header">  
           			 Ajax Pagination  
        			</f:facet>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Firstname" />
						</f:facet>
						<h:outputText value="#{user.firtName}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="lastname" />
						</f:facet>
						<h:outputText value="#{user.lastName}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Email" />
						</f:facet>
						<h:outputText value="#{user.email}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="Password" />
						</f:facet>
						<h:outputText value="#{user.password}" />
					</p:column>
				</p:dataTable>

			</p:panel>
		</h:form>
	</p:dialog>
</ui:composition>
